// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_REP_REPAIR_ORDER
// * CreateDate    : 2011-12-8 19:49:21
// * Creater       : CodeSmith
// * LastChangeDate: 2011-12-8 19:49:21
// * LastChanger   : 2011-12-8 19:49:21
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;
using ESOL.Common;

namespace ESOL.Business.Rep
{
/// <summary>
    /// RepRepairOrder
    /// </summary>
    public partial class RepRepairOrderBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objRepRepairOrderEntity">Entity</param>
        /// <returns>Entity</returns>
        public static RepRepairOrderEntity GetRepRepairOrder(RepRepairOrderEntity objRepRepairOrderEntity)
        {
            return DataAccess.SelectSingle<RepRepairOrderEntity>(objRepRepairOrderEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objRepRepairOrderEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertRepRepairOrder(RepRepairOrderEntity objRepRepairOrderEntity)
        {
            return DataAccess.Insert(objRepRepairOrderEntity);
        }

        public static bool InsertRepRepairOrder(List<RepRepairOrderEntity> objRepRepairOrderEntityList)
        {
            return DataAccess.Insert(objRepRepairOrderEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objRepRepairOrderEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateRepRepairOrder(RepRepairOrderEntity objRepRepairOrderEntity)
        {
            return DataAccess.Update(objRepRepairOrderEntity);
        }

        public static bool UpdateRepRepairOrder(List<RepRepairOrderEntity> objRepRepairOrderEntityList)
        {
            return DataAccess.Update<RepRepairOrderEntity>(objRepRepairOrderEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objRepRepairOrderEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteRepRepairOrder(RepRepairOrderEntity objRepRepairOrderEntity)
        {
            return DataAccess.Delete(objRepRepairOrderEntity);
        }

        public static bool DeleteRepRepairOrder(List<RepRepairOrderEntity> objRepRepairOrderEntityList)
        {
            return DataAccess.Delete<RepRepairOrderEntity>(objRepRepairOrderEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetRepRepairOrderAll()
        {
            return DataAccess.SelectAllDataSet<RepRepairOrderEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<RepRepairOrderEntity> GetRepRepairOrderAllList()
        {
            return DataAccess.SelectAll<RepRepairOrderEntity>();
        }
        #endregion

        #region Functions
        public static RepRepairOrderEntity GetRepairOrderByID(string ID)
        {
            if (string.IsNullOrEmpty(ID))
                return null;
            RepRepairOrderEntity m = new RepRepairOrderEntity();
            m.RepOrderId = ID;
            return DataAccess.SelectSingle<RepRepairOrderEntity>(m);
        }

        public static DataTable GetDtRepRepairOrderByCondition(string Condition, string RowCounts)
        {
            string Sql = CommonFunctions.GetSelect(RowCounts) + @" RRO.*,RA.REP_APPLICATION_CODE,MP.NAME_CN 
                FROM REP_REPAIR_ORDER RRO 
                LEFT JOIN REP_APPLICATION RA ON RRO.REP_APPLICATION_ID=RA.REP_APPLICATION_ID
                LEFT JOIN MST_PERSON MP ON RA.APPLICATION_BY=MP.PERSON_ID
                WHERE 1=1 ";
            DataSet ds = DataAccess.SelectDataSet(Sql);
            if (ds != null && ds.Tables[0] != null)
            {
                return ds.Tables[0];
            }
            else return null;
        }
        #endregion
    }
	
	
}	

